<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $("#username").blur(function () {
                let username = $(this).val();
                //发送请求，等待服务器响应
                $.get("findUsername",{username:username},function (data) {
                    var span = $("#s_username");
                    if (data.Exsit){
                        span.css("color","red");
                        span.html(data.message);
                    }else{
                        span.css("color","green");
                        span.html(data.message);
                    }
                },"json");
            });
        });
    </script>
</head>
<body>
    <form>
        <input type="text" id="username" name="username" placeholder="请输入用户名">
        <span id="s_username"></span>
        <br>
        <input type="password" name="password" placeholder="请输入密码"><br>
        <input type="submit" value="注册">
    </form>
</body>
</html>